/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package repstream.model;

import java.util.ArrayList;
import repstream.Observer.Observable;
import repstream.Observer.Observer;

/**
 *
 * @author bu2spencer
 */
public class Model implements Observable{
    private ArrayList<Observer> listObserver = new ArrayList<Observer>();
    private MediaPlayer mPlayer;
    private String urlFilm;
    //private ServerStream server;
    
    public Model(){
        
    }
    
    public Model(MediaPlayer mplayer){
        this.mPlayer = new MediaPlayer(urlFilm, 0, 0, false);
        System.out.println("Model Created");

    }

    public String getUrlFilm() {
        return mPlayer.getUrlFilm();
    }
 
    public void setUrlFilm(String urlFilm) {  
        mPlayer.setUrlFilm(urlFilm);
        //notifyObserver(this);
    }
    
    @Override
    public void addObserver(Observer obs) {
        this.listObserver.add(obs);
    }

    @Override
    public void notifyObserver(Model model) {
        //element a notifier
        for (Observer obs : listObserver) {
            obs.update(model);
        }
    }

    @Override
    public void removeObserver() {
        listObserver = new ArrayList<Observer>();
    }
}
